package com.jarvan.fluwx_example

import io.flutter.embedding.android.FlutterActivity

import com.sensorsdata.analytics.android.sdk.SAConfigOptions
import com.sensorsdata.analytics.android.sdk.SensorsAnalyticsAutoTrackEventType
import com.sensorsdata.analytics.android.sdk.SensorsDataAPI

class MainActivity: FlutterActivity() {
    fun onCreate() {
        var SA_SERVER_URL = "https://kylin.huanjutang.com/sa?project=production"

        var saConfigOptions = SAConfigOptions(SA_SERVER_URL)
        
        saConfigOptions.setAutoTrackEventType(SensorsAnalyticsAutoTrackEventType.APP_CLICK or
        SensorsAnalyticsAutoTrackEventType.APP_START or
        SensorsAnalyticsAutoTrackEventType.APP_END or
        SensorsAnalyticsAutoTrackEventType.APP_VIEW_SCREEN).enableLog(true)

        SensorsDataAPI.startWithConfigOptions(this, saConfigOptions)
    }

    fun initApp() {
        var SA_SERVER_URL = "https://kylin.huanjutang.com/sa?project=production"

        var saConfigOptions = SAConfigOptions(SA_SERVER_URL)
        
        saConfigOptions.setAutoTrackEventType(SensorsAnalyticsAutoTrackEventType.APP_CLICK or
        SensorsAnalyticsAutoTrackEventType.APP_START or
        SensorsAnalyticsAutoTrackEventType.APP_END or
        SensorsAnalyticsAutoTrackEventType.APP_VIEW_SCREEN).enableLog(true)

        SensorsDataAPI.startWithConfigOptions(this, saConfigOptions)
    }
}
